﻿using System;
using Baosight.ZNH.ZMCommon;
using Baosight.Platform.Core;
using Baosight.Platform.Core.UI.Controls;
using Telerik.Windows.Controls;
using Baosight.ZNH.ZMCL.UI.Blocks;
using System.Collections.Generic;

namespace Baosight.ZNH.ZMCL.UI
{
    public partial class ZMCL74 : EFViewCmes
    {
        RiskBlock block = new RiskBlock();

        public ZMCL74()
        {
            InitializeComponent();
        }

        public override void Initialize(Baosight.Platform.Core.EIInfo initData)
        {
            initData.AddBlock(block.GetIsPenaltyBlock(true));
            initData.AddBlock(block.GetModifyStatusBlock(true));
            this.fdEndDate.Value = DateTime.Now.ToString("yyyy-MM-dd");
            base.Initialize(initData);
        }

        /// <summary>
        /// 切换选择
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Grid_SelectionChanged(object sender, SelectionChangeEventArgs e)
        {
            if (null != this.Grid.SelectedItem)
            {
                EIRow _row = (this.Grid.SelectedItem as UIBaseEntity).GetEIRow();

                Dictionary<string, string> args = new Dictionary<string, string>();
                args.Add("fdRiskRecordId", _row["fdKeyId"].ToString());
                this.riskDetails.LoadView<EFCustomViewContainerPanel>("ZMCL71", args);//加载从表页面

                Dictionary<string, string> args1 = new Dictionary<string, string>();
                args1.Add("fdPenaltyIds", _row["fdPenaltyIds"] == null ? "" : _row["fdPenaltyIds"].ToString());
                this.riskPenalty.LoadView<EFCustomViewContainerPanel>("ZMCL75", args1);//加载从表页面
            }
            else
            {
                this.riskDetails.Content = null;
                this.riskPenalty.Content = null;
            }
        }
    }
}
